import router from "../../router"
import $bus from "../../eventbus/bus"

router.beforeEach((to,from)=>{
    // console.log("to",to);
    // console.log("from",from);
    let token = sessionStorage.getItem('data')

    if(!token){

        if(to.path !== "/login"){
            return {
                path: "/login"
            }
        }
    }

})

router.afterEach((to,from)=>{
    console.log("to",to);
    console.log("from",from);
    $bus.$emit("breadChange",to.matched)
})